$(function () {

    getLoad();

})

function getLoad() {

    var e = document.createEvent("MouseEvents");
    e.initEvent("click", true, true);

    $.post("/user/getUser/",function (userObj) {
        if(userObj.length == 0){
            alert("请先登录");
            location.href="/html/login.html";
        }

        $("#LoginUser").html(userObj.name)
        document.getElementById(userObj.userRoot[0].name).dispatchEvent(e);


        for(var i=0;i<userObj.userRoot.length;i++){
            var str = userObj.userRoot[i].name;
            var root = document.getElementById(str);
            $(root).parent().parent().prev().show();
            $(root).show();

        }

        $("#userName").html(userObj.name);

    });
}

function reLogin() {
    location.href="/html/login.html";
}



